<!DOCTYPE HTML>
<html>

<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<link rel="stylesheet" type="text/css" href="./css/index.css">
<title>Erasing Information</title>
</head>

<body id="fondo">
<div id="cuerpo">
<fieldset style="width: 1000px; color: #FFF;";>
<?php
        include 'header.php';

$selected=$_POST['selected'];
$link = mysqli_connect('localhost', 'root', '');

if (mysqli_connect_errno()) {
        echo 'You cannot connect to mysql';
        exit;
}

$sql = "USE web_db";
$resultado = mysqli_query($link,$sql);

$n_nr=$_POST['erase_id'];

$sql = "DELETE FROM news WHERE n_nr='$n_nr'";

$data = mysqli_query ($link,$sql)or die($mysqli->error);

if($data){
	echo "You erased from $selected succesfully";
}

header("location:news_page.php");
?>

<p>Would you like to come back?</p>
<a HREF="admin.php"><input type="button" value="Administration"></a>
<form name="table_select" method='POST' action="table_data.php">
	<input type="hidden" name="tabla" value=<?php echo "'$selected'"; ?> />
	<input type="submit" value="Table Data">
</form>
<a HREF="index.php"><input type="button" value="Index"></a>
<?php
    include 'footer.php';
?>
</fieldset>
</div>
</body>